package com.zkr.kfkq.mapper;

import com.zkr.kfkq.model.*;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import javax.validation.constraints.NotBlank;
import java.util.List;

/**
 *Created by lenovo on 2021/01/14.
 */
@Mapper
public interface KFKQMapper {
    int queryCount(KFKQSelectVo kfkqSelectVo);

    List<KFKQVo> queryPage(KFKQSelectVo kfkqSelectVo);

    void updateStatus(KQVo kqVo);

    @Select("select warehouseId id, wareHouseCode code,wareHouseName name,wareHouseRemark remark from warehouse ")
    List<KFVo> querykf();

    KFKQVo query(Integer id);

    @Select("select code,name,remark from eulogy")
    List<EulogyVo> queryEulogy();

    @Select("select * from kuqu where kqcode=#{code}")
    KFKQVo queryCode(@NotBlank(message = "库区编码不能为空!") String code,String wareHouseCode);

    @Select("select * from kuqu where kqname = #{name}")
    KFKQVo queryName(@NotBlank(message = "库区名称不能为空!") String name,String wareHouseName);


    @Insert("insert into kuqu(kqcode,kqname,kqremark,status,wareHouseCode,warehouseManagement,wmsIntegrate,vipStorageSection,createName,createTime,updateName,updateTime)"+
    "values (#{code},#{name},#{remark},#{status},#{wareHouseCode},#{warehouseManagement},#{wmsIntegrate},#{vipStorageSection},#{createName},#{createTime},#{updateName},#{updateTime})")
    void add(KFKQVo kfkqVo);

    void update(KFKQVo kfkqVo);




   // void add2(List<PropertiesVo> businessAttribute, Integer id);

    @Select("select kid from kuqu where kqcode=#{code}")
    Integer queryCodes(@NotBlank(message = "库区编码不能为空!") String code);

    void addAttribute(Integer id, List<ReservoirAttributesVo> list);

    @Delete("delect from kuqu_eulogy where kid=#{id}")
    void deleteAttribute(Integer id);
}
